package com.har01d.lang.compiler.generator;

import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;

import com.har01d.lang.compiler.domain.statement.FieldDeclaration;
import com.har01d.lang.compiler.domain.variable.Field;

public class FieldDeclarationGenerator {

    private final ClassWriter classWriter;

    public FieldDeclarationGenerator(ClassWriter classWriter) {
        this.classWriter = classWriter;
    }

    public void generate(FieldDeclaration fieldDeclaration) {
        Field field = fieldDeclaration.getField();
        classWriter.visitField(Opcodes.ACC_PUBLIC, field.getName(), field.getType().getDescriptor(), null, null);
        classWriter.visitEnd();
    }

}
